import requests

def test_event_stream(url, headers=None):
    try:
        response = requests.get(url, headers=headers, stream=True)
        for line in response.iter_lines():
            if line:
                print(line.decode('utf-8'))
    except Exception as e:
        print(f"Error: {e}")

# 示例用法
url = "https://www.chessdb.cn/llm.php?lang=0&action=ccllm&board=rnbakabnr/9/7c1/p1p1p1p1p/9/P8/2P1P1P1P/1C5C1/4A4/RcBAK1BNR%20b&egtbmetric=dtm"
headers = {
    "Accept": "text/event-stream",
    "Authorization": "www.chessdb.cn",
    "referer": "https://www.chessdb.cn/query/"
}
test_event_stream(url, headers)